export const directive = {
  install (app, options) {
    app.directive('permission', (el, binding) => {
      let permissions = []
      if (localStorage.getItem('permissions')) {
        permissions = JSON.parse(localStorage.getItem('permissions'))
      }
      if (!Array.isArray(permissions)) {
        permissions = []
      }
      let value = binding.value
      if (value) {
        let flag = permissions.includes(value)
        if (!flag) {
          el && el.remove()
        }
      }
    })
  }
}